<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>dongtaiTime</title>
    <script>
        var time ;
        function nowTime() {
            var d = new Date();
            var w  = ["周日","周一","周二","周三","周四","周五","周六"]
            var hours = d.getHours();
            var minutes = d.getMinutes();
            var seconds = d.getSeconds();
            var week = w[d.getDay()];
            var month = d.getMonth()+1;
            var year = d.getFullYear();
            var day = d.getDate();
            time = "现在是："+week+","+year+"年"+month+"月"+day+"日"+hours+"时"+minutes+"分"+seconds+"秒";
            document.getElementById("now").innerText = time;
        }
        
        function initTime() {
            nowTime();
            timer = setInterval("nowTime()",1000);
        }
    </script>
</head>
<body onload="initTime()">
<div id = "now">
    <input type="button" value="没用的"/>
</div>
</body>
</html>